package case1_4;

import java.util.Scanner;

public class case1 {
    public static void main(String[] args) {
        /*减肥计划：输入星期数，显示今天的减肥活动
         （周一：跑步；周二：游泳；周三：慢走；周四：动感单车；周五：拳击；周六：爬山；周日：好好吃一顿）。*/
        Scanner sc = new Scanner(System.in);
        System.out.println("请用数字输入今天的星期数(1-7)：");
        int week = sc.nextInt();
        //方法一：if……else
        /*while (true) {
            if (week < 1 || week > 7) {
                System.out.println("您输入的星期数有误，请重新输入（1-7）：");
                week = sc.nextInt();
            } else if (week == 1) {
                    System.out.println("周一：跑步");
                    break;
                }
            else if (week == 2) {
                System.out.println("周二：游泳");
                break;
            } else if (week == 3) {
                System.out.println("周三：慢走");
                break;
            } else if (week == 4) {
                System.out.println("周四：动感单车");
                break;
            } else if (week == 5) {
                System.out.println("周五：拳击");
                break;
            } else if (week == 6) {
                System.out.println("周六：爬山");
                break;
            } else if (week == 7) {
                System.out.println("周日：好好吃一顿");
                break;
            }
        }*/

        //方法二：switch
        switch (week) {
                    case 1 :
                        System.out.println("周一：跑步");
                        break;
                    case 2 :
                        System.out.println("周二：游泳");
                        break;
                    case 3 :
                        System.out.println("周三：慢走");
                        break;
                    case 4 :
                        System.out.println("周四：动感单车");
                        break;
                    case 5 :
                        System.out.println("周五：拳击");
                        break;
                    case 6 :
                        System.out.println("周六：爬山");
                        break;
                    case 7 :
                        System.out.println("周日：好好吃一顿");
                        break;
                    default:
                        System.out.println("您输入的数据有误！");
            }
    }
}
